package com.openNetty.server.core;

import com.openNetty.common.api.BackSqlFile;
import com.openNetty.common.bean.ComRequest;
import com.openNetty.common.bean.ComResponse;
import com.openNetty.common.system.LoggerUtil;
import com.openNetty.server.nettyserver.Global;

import static com.openNetty.common.bean.HttpInfo.SUCCESS;


/**
 * 实现获取sql备份文件
 *
 * @version 1.0.0
 * @Author zhenggm
 */
public class BackSqlFileImpl implements BackSqlFile {

    private static LoggerUtil logger = LoggerUtil.getLogger(BackSqlFileImpl.class);

    @Override
    public ComResponse getSqlBackFile(ComRequest comRequest) {
        logger.debug("执行传输任务开始");
        String path = Global.ROOT;
        // 要传输的文件路径
        String fileName = comRequest.getHttpAck().getFileName();
        String filePath = path +"/"+ fileName;
        ComResponse comResponse = new ComResponse();
        comResponse.setFilePath(filePath);
        comResponse.setSuccess(true);
        comResponse.setResult(SUCCESS);
        return comResponse;
    }
}
